<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
	<title>菜单管理</title>
	<%@include file="/common/jsp/taglib.jsp"%>
	<script type="text/javascript" src="${ctx }common/system/assets/fuelux/js/spinner.min.js"></script>
	
	
	<script type="text/javascript">
		
	
	$(function(){
		common.refreshSelect('pid','menuLev1');
		
		$('#spinner4').spinner({value:1, step: 1, min: 1, max: 200});
		setTimeout(initMenuConfig, 500);
	});
	
	function submitform(){
		var d = $("#menuform").serialize();
		var url = ctx + "menu/saveMenu.do";
		common.submitForm2Path('menuform',url);
		return ;
		
	}
	


	function initMenuConfig() {
		showCont();
		// radio动态展示
		$("input[name=lev]").click(function() {showCont();});
	}

	function showCont() {
		var lev = $("input[name=lev]:checked").attr("value");
		switch (lev) {
		case "1":
			$("#dynamicShowPid").hide();
			$("#dynamicShowUrl").hide();
			break;
		case "2":
			$("#dynamicShowPid").show();
			$("#dynamicShowUrl").show();
			$("#pid").val($("#menuPid").val());
			break;
		default:
			break;
		}
	}
	
	
	</script>
</head>
<body>
				<!-- 主体内容开始 -->
				<div class="row">
					<div class="col-lg-12">
						<section class="panel">
 							<header class="panel-heading">
 								<div class=" alert-info" ><strong>
 								<c:if test="${entity.id==0 }">新建菜单</c:if>
 								<c:if test="${entity.id!=0 }">编辑菜单</c:if>
 								</strong></div>
 							</header> 
							<div class="panel-body">
								<form class="form-horizontal tasi-form" role="form" id="menuform" >
									<input type="hidden" id="hiddenPid" value="${entity.pid}" />
									<div class="form-group"> 
                                          <label class="col-sm-2 col-sm-2 control-label"><b>菜单名称</b></label>
                                          <div class="col-sm-10">
                                              <input type="text" id="name" name="name" value="${entity.name}" class="form-control" required> 
                                          </div>
                                    </div>
                                    <div class="form-group">
										<label class="col-sm-2 col-sm-2 "><b>内容链接</b></label>
										<div class="col-sm-10">
											<div class="radio">
                                              <label>
                                                  <input type="radio" name="lev" id="lev1" value="1" style="margin:0;float: none;"   <c:if test="${entity.lev==1 }">checked</c:if>  />
                                                  <label for="lev1"  >一级菜单</label>&nbsp;&nbsp;&nbsp;
                                                  <input type="radio" name="lev" id="lev2" value="2"  style="margin:0;float: none;"  <c:if test="${entity.lev==2 }">checked</c:if> />
                                                  <label for="lev2" >二级菜单</label>
                                              </label>
                                          </div>
										</div>
									</div>
                                    <div class="form-group" style="display:none" id="dynamicShowPid">
                                    <input type="hidden" value="${entity.pid }" id="menuPid" />
										<label class="col-sm-2 col-sm-2 control-label"><b>菜单父级关联</b></label>
										<div class="col-sm-10">
											<select class="form-control m-bot15" id="pid" name="pid">
                                          	</select>
										</div>
									</div>
                                    <div class="form-group" style="display:none" id="dynamicShowUrl">
										<label class="col-sm-2 col-sm-2 control-label"><b>菜单资源url</b></label>
										<div class="col-sm-10">
											<input type="text" id="value" name="value" value="${entity.value}" class="form-control" required> 
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 col-sm-2 control-label"><b>菜单序号</b></label>
										<div class="col-sm-10">
											<div id="spinner4"> 
											
											
												<div style="width:150px;" class="input-group">
                                                      <div class="spinner-buttons input-group-btn">
                                                          <button class="btn spinner-up btn-warning" type="button">
                                                              <i class="icon-plus"></i>
                                                          </button>
                                                      </div>
                                                      <input type="text" id="position" name="position" readonly="" maxlength="3" value="${entity.position }" class="spinner-input form-control">
                                                      <div class="spinner-buttons input-group-btn">
                                                          <button class="btn spinner-down btn-danger" type="button">
                                                              <i class="icon-minus"></i>
                                                          </button>
                                                      </div>
                                                  </div>
											
                                               
                                               
                                               
                                            </div>
										</div>
									</div>
									<div class="form-group text-center">
										<input type="hidden" id="id" name="id" value="${entity.id}"/>
										<input type="hidden" name="statement" value="${statement }"  />
										<input type="hidden" name="tourl" value="${tourl }"  />
										<button type="button" class="btn btn-info" onclick="submitform();"><i class="icon-ok"></i><b>&nbsp;提 交</b></button> 
										<button type="button" class="btn btn-info" onclick="common.backToList();"><i class="icon-reply"></i><b>&nbsp;返 回</b></button> 
									</div>
								</form>
							</div>
						</section>
					</div>
				</div>
				<!-- 主体内容结束 -->
</body>
</html>